var pie_001 = echarts.init(document.getElementById('pie-001'));
pie_001.setOption({
    tooltip: {
        trigger: 'item',
        formatter(params){
            return params.name+ '<br/>'+params.seriesName+"："+params.value+' ('+params.percent+'%)'+'<br/>'+"项目金额："+params.data.budget;
        }
    },
    series: [{
            name: '项目数量',
            type: 'pie',
            radius: '55%',
            center: ['50%', '60%'],
            data: [],
            emphasis: {
            itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: 'rgba(0, 0, 0, 0.5)'
            }
        }
    }]
});

common();

function search() {
    var sdate = $('#sdate').val();
    var edate = $('#edate').val();
    var param = {sdate:sdate, edate:edate}
    common(param);
}

function common(param = null){var date=new Date;
    var date=new Date;
    var y = date.getFullYear()
    $('#sdate').val(y+'-01-01');

    $.get('./index.php?a=totalProjecter&m=report|main&d=report', param).done(function (data) {
        data = JSON.parse(data)
        pie_001.setOption({
            series: [{
                data:data
            }]
        });
    });
}

pie_001.on('click', function (params) {
    let sdate = $('#sdate').val();
    let edate = $('#edate').val();
    console.log(sdate,edate);
    let urls = 'report,main,list,puid='+params.data.puid+',sdate='+sdate+',edate='+edate;
    addtabs({num:'num329',url:urls,icons:'',name:'采购项目执行汇总'});
});